import {
	createApp
} from 'vue'
// import Cookies from 'js-cookie'
import 'normalize.css/normalize.css'
// import './assets/iconfonts/iconfont.css'
// import '@/assets/fonts/fonts.css'
import './styles/element-variables.scss'
import ElementPlus from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'

import http from './utils/request'
window.axios = http

import 'element-plus/dist/index.css'
import './styles/index.scss'
import "./assets/iconfont/iconfont.js";
import "./assets/iconfont/iconfont.css";
import Avue from '@smallwei/avue'
import '@smallwei/avue/lib/index.css'
import "v-contextmenu/dist/themes/default.css";

import App from './App.vue'
import router from "./router/index";
import store from "./store/index";
import Tinymce from '/@/components/tinymce/tiny.vue'
import WMTree from '/@/components/from/WMTree.vue'
import wmText from '/@/components/from/wmText.vue'
import basicContainer from '/@/components/basic-container/main.vue'

import loadScript from './plugins/map.js'
import './permission'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import Echarts from "vue-echarts"
import * as echarts from "echarts"
import DataVVue3 from '@kjgl77/datav-vue3'

//import Tinymce from '/@/components/Tinymce/index.vue'//这个东西不能弄为局部引入，不然热更新会报错
const app = createApp(App);
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
	app.component(key, component)
}
app.component('basicContainer', basicContainer);
app.component("Tinymce", Tinymce)
app.component("WMTree", WMTree)
app.component("wmText", wmText)
app.component("e-chart", Echarts)

app.config.globalProperties.$echarts = echarts
app.config.globalProperties.$store = store
app.config.globalProperties.$router = router

const getServerConfig = async () => {
	app
		.use(router)
		.use(store)
		.use(ElementPlus, {
			locale: zhCn,
		}).use(loadScript)
		.use(Avue)
		.use(DataVVue3)
	await router.isReady();
	app.mount('#root', false)
}
getServerConfig()
